package com.sanji.sjmallmodule.launch;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ImageView;

import com.sanji.sjmallapp.BaseActivity;
import com.sanji.sjmallapp.R;
import com.sanji.sjmallmodule.login.LoginActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SplashActivity extends BaseActivity implements View.OnClickListener {
    @BindView(R.id.splash_go_in_img)
    ImageView splashGoInImg;
    private Handler mHandler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        ButterKnife.bind(this);
        mHandler.postDelayed(runnable, 3000);
        splashGoInImg.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.splash_go_in_img:
                intent = new Intent(this, LoginActivity.class);
                startActivity(intent);
                mHandler.removeCallbacks(runnable);
                finish();
                break;
        }
    }

    private Runnable runnable = new Runnable() {
        @Override
        public void run() {
            intent = new Intent(SplashActivity.this, LoginActivity.class);
            startActivity(intent);
            finish();
        }
    };

}
